﻿<Window x:Class="Gao.Poker.App.Win.EditProductWin"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="酒水入库" WindowStartupLocation="CenterScreen" ResizeMode="NoResize" Width="1000">
    <Grid Margin="0">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="4*"/>
            <ColumnDefinition Width="6*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="40.73"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Border BorderBrush="White" BorderThickness="0,1" Margin="0,1,0,0" Grid.ColumnSpan="2">
            <Border.Background>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#A1C7CFDA" Offset="0.991"/>
                    <GradientStop Color="#B5F1F1F1"/>
                    <GradientStop Color="#FFD2D2D2" Offset="1"/>
                </LinearGradientBrush>
            </Border.Background>
        </Border>
        <Button Content="新增商品" Name="btnNew" HorizontalAlignment="Left" Margin="0,8.865,0,8.865" Style="{DynamicResource MyButton}" Width="101" Height="25" Grid.Column="0" Grid.ColumnSpan="2"/>
        <Border BorderBrush="#CCFFFFFF" BorderThickness="1,0,0,0" HorizontalAlignment="Left" Margin="107.75,7.372,0,7.25" Width="2.5" Background="#FFB6B6B6" Grid.Column="0" Grid.ColumnSpan="2"/>
        <StackPanel Margin="1" Grid.Column="0" Grid.Row="1" Orientation="Vertical">
            <StackPanel Margin="5,5,5,5" Orientation="Horizontal" Background="{DynamicResource ButtonNormalBackground}">
                <TextBox Name="txtProdcutName" Width="220" Margin="30,5,5,5" Text="{Binding Path=ProductName}"/>
                <Button x:Name="btnSearch" Content="搜索" Margin="5" Style="{DynamicResource Orrange}"/>
            </StackPanel>
            <ListView Name="listView" Margin="0,0,0,0" Height="429" 
                      ItemsSource="{Binding Path=Products}" SelectedItem="{Binding Path=Product}"
              VirtualizingStackPanel.VirtualizationMode="Recycling">
                <ListView.View>
                    <GridView>
                        <GridViewColumn Header="编码" Width="80" DisplayMemberBinding="{Binding BarCode}"/>
                        <GridViewColumn Header="名称" Width="160" DisplayMemberBinding="{Binding ProductName}"/>
                        <GridViewColumn Header="单价" Width="60" DisplayMemberBinding="{Binding PPrice}"/>
                        <GridViewColumn Header="数量" Width="80" DisplayMemberBinding="{Binding PNumber}"/>
                    </GridView>
                </ListView.View>
            </ListView>
        </StackPanel>
        <DockPanel Name="content" Grid.Column="1" Grid.Row="1" Margin="0">
            <Grid Margin="5">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="150"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="60"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="30"/>
                    <RowDefinition Height="30"/>
                    <RowDefinition Height="30"/>
                    <RowDefinition Height="30"/>
                    <RowDefinition Height="30"/>
                    <RowDefinition Height="30"/>
                    <RowDefinition Height="30"/>
                    <RowDefinition Height="30"/>
                    <RowDefinition Height="85"/>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="50"/>
                </Grid.RowDefinitions>

                <TextBlock Grid.Column="0" Grid.Row="0" Text="商品名称：" Margin="1" VerticalAlignment="Center" HorizontalAlignment="Right"/>
                <TextBox Text="{Binding Path=Product.ProductName}" Margin="1" Grid.Column="1" VerticalContentAlignment="Center" Grid.Row="0"/>

                <TextBlock Grid.Column="0" Grid.Row="1" Text="商品编码：" Margin="1" VerticalAlignment="Center" HorizontalAlignment="Right"/>
                <TextBox Text="{Binding Path=Product.BarCode}" Margin="1" Grid.Column="1" VerticalContentAlignment="Center" Grid.Row="1"/>

                <TextBlock Grid.Column="0" Grid.Row="2" Text="计量单位：" Margin="1" VerticalAlignment="Center" HorizontalAlignment="Right"/>
                <TextBox Text="{Binding Path=Product.PUnit}" Margin="1" Grid.Column="1" VerticalContentAlignment="Center" Grid.Row="2"/>

                <TextBlock Grid.Column="0" Grid.Row="3" Text="数量：" Margin="1" VerticalAlignment="Center" HorizontalAlignment="Right"/>
                <TextBox Text="{Binding Path=Product.PNumber}" Margin="1" Grid.Column="1" VerticalContentAlignment="Center" Grid.Row="3"/>

                <TextBlock Grid.Column="0" Grid.Row="4" Text="单价：" Margin="1" VerticalAlignment="Center" HorizontalAlignment="Right"/>
                <TextBox Text="{Binding Path=Product.PPrice}" Margin="1" Grid.Column="1" VerticalContentAlignment="Center" Grid.Row="4"/>

                <TextBlock Grid.Column="0" Grid.Row="5" Text="兑换所需积分：" Margin="1" VerticalAlignment="Center" HorizontalAlignment="Right"/>
                <TextBox Text="{Binding Path=Product.PIntegral}" Margin="1" Grid.Column="1" VerticalContentAlignment="Center" Grid.Row="5"/>

                <TextBlock Grid.Column="0" Grid.Row="6" Text="保质期：" Margin="1" VerticalAlignment="Center" HorizontalAlignment="Right"/>
                <DatePicker Text="{Binding Path=Product.BZQ}" Margin="1" Grid.Column="1" VerticalContentAlignment="Center" Grid.Row="6"/>

                <TextBlock Grid.Column="0" Grid.Row="7" Text="入库时间：" Margin="1" VerticalAlignment="Center" HorizontalAlignment="Right"/>
                <TextBlock Text="{Binding Path=Product.StockDate, StringFormat='yyyy-MM-dd hh:mm:ss'}"  VerticalAlignment="Center" Margin="1" Grid.Column="1" Grid.Row="7"/>

                <TextBlock Grid.Column="0" Grid.Row="8" Text="备注：" Margin="1" VerticalAlignment="Center" HorizontalAlignment="Right"/>
                <TextBox Text="{Binding Path=Product.Remark}" Margin="1" Grid.Column="1" VerticalContentAlignment="Center" Grid.Row="8" Height="80"/>

                <StackPanel Orientation="Horizontal" Grid.ColumnSpan="2"  Grid.Row="10" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Center">
                    <Button Padding="5" Style="{DynamicResource Orrange}" Width="60" FontSize="16" Height="35" Name="btnLogin" 
                    Command="{Binding SaveCommand}" CommandParameter="{Binding Product}">保存</Button>
                </StackPanel>
            </Grid>
        </DockPanel>
    </Grid>
</Window>
